package com.cn.web.controller.EM.sell;
import com.alibaba.fastjson2.JSONObject;
import com.cn.bean.vo.EM.partRegt.BarkPar;
import com.cn.mapper.dao.db5.EM.sell.ScrapChargedDao;
import com.cn.mapper.dao.db5.EM.wo_manage.WOReportGrindDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@Transactional
@RequestMapping("/ScrapCharged")
public class ScrapChargedController {
    private final ScrapChargedDao scrapChargedDao;


    @Autowired(required = false)
    public ScrapChargedController(ScrapChargedDao scrapChargedDao) {
        this.scrapChargedDao = scrapChargedDao;
    }

    @RequestMapping("/insert")
    @ResponseBody
    public BarkPar insert(@RequestBody JSONObject jsonObject) {
        System.out.println("jsonObject:aaaaaaaaaaaaaaa" + jsonObject);


        return scrapChargedDao.insert(String.valueOf(jsonObject));

    }

    @RequestMapping("/getSing")
    @ResponseBody
    public String getSing(@RequestBody JSONObject jsonObject) {
        System.out.println("jsonObject:aaaaaaaaaaaaaaa" + jsonObject);
        return scrapChargedDao.getSing(String.valueOf(jsonObject));
    }

    @RequestMapping("/getList")
    @ResponseBody
    public String getList(@RequestBody JSONObject jsonObject) {
        System.out.println("jsonObject:aaaaaaaaaaaaaaa" + jsonObject);
        String list = scrapChargedDao.getList(String.valueOf(jsonObject));
        System.out.println("xxxxxxxxxxxxxx:" + list);
        return list;
    }


    @RequestMapping("/getInfo")
    @ResponseBody
    public String getInfo(@RequestBody JSONObject jsonObject) {
        System.out.println("jsonObject:ccccccccccc" + jsonObject);
        String list = scrapChargedDao.getInfo(String.valueOf(jsonObject));
        System.out.println("assxxxxxxxxxx:" + list);
        return list;
    }

    @RequestMapping("/stateUp")
    @ResponseBody
    public BarkPar stateUp(@RequestBody JSONObject jsonObject) {
        System.out.println("jsonObject:ccccccccccc" + jsonObject);

        return scrapChargedDao.stateUp(String.valueOf(jsonObject));
    }
}
